package com.example.houduan.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.houduan.entity.Yq;
import com.example.houduan.mapper.YqMapper;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class YqService extends ServiceImpl<YqMapper, Yq>{

    //获取20条数据
    public List<Yq> getList() {
        LambdaQueryWrapper<Yq> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.orderByDesc(Yq::getId);
        queryWrapper.last("limit 20");
        return this.list(queryWrapper);
    }
}
